AMD IOMMU: fix Dom0 device setup failure for host bridges
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Fri, 27 Sep 2013 08:11:49 +0000 (10:11 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 27 Sep 2013 08:11:49 +0000 (10:11 +0200)
commit0af438757d455f8eb6b5a6ae9a990ae245f230fd
tree2c522f2098841db0e8a22f87bfe132b3cf6d68cd
parent1aac966e24e92d664089cfa075f21bbb570a7d58
AMD IOMMU: fix Dom0 device setup failure for host bridges

The host bridge device (i.e. 0x18 for AMD) does not require IOMMU, and
therefore is not included in the IVRS. The current logic tries to map
all PCI devices to an IOMMU. In this case, "xl dmesg" shows the
following message on AMD sytem.

(XEN) setup 0000:00:18.0 for d0 failed (-19)
(XEN) setup 0000:00:18.1 for d0 failed (-19)
(XEN) setup 0000:00:18.2 for d0 failed (-19)
(XEN) setup 0000:00:18.3 for d0 failed (-19)
(XEN) setup 0000:00:18.4 for d0 failed (-19)
(XEN) setup 0000:00:18.5 for d0 failed (-19)

This patch adds a new device type (i.e. DEV_TYPE_PCI_HOST_BRIDGE) which
corresponds to PCI class code 0x06 and sub-class 0x00. Then, it uses
this new type to filter when trying to map device to IOMMU.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reported-by: Stefan Bader <stefan.bader@canonical.com>
On VT-d refuse (un)mapping host bridges for other than the hardware
domain.

Coding style cleanup.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
xen/drivers/passthrough/amd/pci_amd_iommu.c
xen/drivers/passthrough/pci.c
xen/drivers/passthrough/vtd/intremap.c
xen/drivers/passthrough/vtd/iommu.c
xen/include/xen/pci.h